#!/bin/bash
# deploy kata and contained environment

tar -C / -xvf kata-static-2.5.2-x86_64.tar.xz
tar -C / -xvf cri-containerd-cni-1.6.6-linux-amd64.tar.gz
sed -i 's/modprobe overlay/modprobe -a overlay vhost-vsock/g' /etc/systemd/system/containerd.service
ln -s /opt/kata/bin/containerd-shim-kata-v2 /usr/local/bin/containerd-shim-kata-v2
ln -s /opt/kata/bin/kata-collect-data.sh /usr/local/bin/kata-collect-data.sh
ln -s /opt/kata/bin/kata-monitor /usr/local/bin/kata-monitor
ln -s /opt/kata/bin/kata-runtime /usr/local/bin/kata-runtime
cp -f /bin/qemu-system-x86_64 /opt/kata/bin/qemu-system-x86_64
ln -s /opt/kata/bin/qemu-system-x86_64 /usr/local/bin/qemu-system-x86_64
cp -rf /usr/share/qemu /opt/kata/share/
systemctl daemon-reload
systemctl enable containerd.service
systemctl start containerd.service
